USE [bmig_Mensual_Post_cadena]
GO

IF EXISTS (SELECT name FROM   sysobjects WHERE  name = N'[dbo].[WASP_M0014_LIMPIA_TABLAS]' AND type = 'P')
    DROP PROCEDURE [dbo].[WASP_M0014_LIMPIA_TABLAS]
GO

CREATE PROCEDURE [dbo].[WASP_M0014_LIMPIA_TABLAS]

AS

		if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[seg_cesantia]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
		drop table [dbo].[seg_cesantia]
		GO

		if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[as_seg_cesantia_1]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
		drop table [dbo].[as_seg_cesantia_1]
		GO

		if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[comunas]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
		drop table [dbo].[comunas]
		GO

		if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[seg_cesantia_2]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
		drop table [dbo].[seg_cesantia_2]
		GO

		if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sc_valseg]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
		drop table [dbo].[sc_valseg]
		GO

		if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sc_codseg]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
		drop table [dbo].[sc_codseg]
		GO

		if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sc_segcesa]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
		drop table [dbo].[sc_segcesa]
		GO

		if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[prim_comCesan]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
		drop table [dbo].[prim_comCesan]
		GO

		if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sc_seg]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
		drop table [dbo].[sc_seg]

		if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[seguro_cesantia]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
		drop table [dbo].[seguro_cesantia]